Repository navigation
Add Octavia quota limit and usage queries - #11
Merged
Mohammed Naser (mnaser) merged 1 commit intoDec 4, 2026
Merged
Mohammed Naser (mnaser) merged 1 commit into
Mohammed Naser (mnaser) merged 1 commit into
Conversation
Mohammed Naser (mnaser)
requested changes
Dec 3, 2026
Mohammed Naser (mnaser)
left a comment
Member
There was a problem hiding this comment.
The SQL queries (QuotaGetAll, QuotaUsageGetAll), QuotaRepository wrapper, and sqlc generation look clean and fit right into octavia/db/repositories. Exposing both QuotaGetAll (with Octavia's cached in_use_* counters) and QuotaUsageGetAll (with clear caveats about the seven unindexed table scans) is great library design.
A few cleanup items before we run CI and merge:
- Rebase onto
mainto resolve the merge conflict inAPI.md(from Designate #9). - Update the PR title and description to match the final code, and squash the two commits into one clean commit (keeping DCO sign-off). The title is currently the raw branch name (
Contrib/octavia quotas 2b2) and the description still references commit 1's removed per-resource count methods, Python SQL tests, CI discovery, andtestutildriver registration. - Move the detailed Octavia quota docs from
README.mdintoAPI.md: Please keepREADME.mdto the package summary table entry (matching #13 and Designate #9) and put the detailed semantics inAPI.md.
Add two read-only Octavia quota queries and a QuotaRepository that wraps them: - QuotaGetAll (QuotaRepository.GetAll): one row per project from the quotas table, with the stored limits for all seven quota resources and Octavia's cached in_use_* counters, which check_quota_met and decrement_quota enforce against. Limits and counters are nullable; NULL, zero and -1 limits are returned as stored. - QuotaUsageGetAll (QuotaRepository.GetUsage): recounts load balancers, listeners, pools, members, health monitors, L7 policies and L7 rules per project with check_quota_met's predicate (the object's own project_id and provisioning_status != 'DELETED'). Each table is counted independently, so no parent join can multiply or drop counts, and projects without quota rows are included. Comparing the two reads shows counter drift. Octavia defines no index on project_id or provisioning_status, so the recount scans all seven object tables and suits a less frequent drift check rather than every scrape. Both reads exclude empty project IDs, which Octavia rejects. Add the quota and object tables to the Octavia schema fixture, unit tests, a MariaDB integration test with a fixture covering matching and drifted counters, smoke calls in TestOctaviaQueries, and API.md documentation. Co-authored-by: David Hulick <dave.hulick@gmail.com> Signed-off-by: David Hulick <dave.hulick@gmail.com> Signed-off-by: Jeremy Lee <jeremy.lee1664@gmail.com>
Jeremy Lee (legit-ninja)
force-pushed
the
contrib/octavia-quotas-2b2
branch
from
December 3, 2026 17:54
e5d6e1b to
d0c9d48
Compare
This was referenced Dec 3, 2026
Open
feat(manila): add quota metrics and logical share inventory
vexxhost/openstack_database_exporter#163
Open
Mohammed Naser (mnaser)
approved these changes
Dec 4, 2026
Mohammed Naser (mnaser)
left a comment
Member
There was a problem hiding this comment.
Thanks for the updates—CI is green, approving and merging.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Add two read-only Octavia quota queries to
octavia/db/repositories, plus aQuotaRepositorythat wraps them:QuotaGetAll(QuotaRepository.GetAll): one row per project from thequotastable, with the stored limits for all seven quota resources and Octavia's cachedin_use_*counters.QuotaUsageGetAll(QuotaRepository.GetUsage): a per-project recount of load balancers, listeners, pools, members, health monitors, L7 policies and L7 rules.Motivation
Octavia enforces quota against the cached
in_use_*counters (check_quota_met,decrement_quota), and those counters can drift from the real objects. Exposing both reads lets a consumer report what Octavia enforces today and compare it with what the counters should be.Behavior
QuotaGetAllreturns limits and counters assql.NullInt32. A NULL limit means no explicit override; zero and-1remain distinct. Callers resolve configured defaults. A NULL or zero counter means Octavia recounts on its next quota check for that project.QuotaUsageGetAllusescheck_quota_met's predicate: the object's ownproject_idandprovisioning_status != 'DELETED', so ERROR and pending objects count. Each table is counted independently, so no parent join multiplies or drops counts, and projects without quota rows are included. Only nonzero project/resource groups are returned.MissingProjectID).project_idorprovisioning_status, soQuotaUsageGetAllscans all seven object tables.QuotaGetAllreads onlyquotasand is cheap enough for every scrape; the recount suits a less frequent drift check on large deployments.Compatibility
The change is additive; existing Octavia repositories are unchanged. The
quotastable and minimal object tables are added to the Octavia schema fixture for tests and code generation; they are not production migrations.Tests and docs
TestOctaviaQuotas(MariaDB integration) with a fixture covering matching and drifted counters, ERROR and pending objects, deleted parents and usage-only projects.TestOctaviaQueries.API.md;README.mdonly addsQuotaRepositoryto the package table.